package com.kun.music.service.impl;

import com.kun.music.dao.CollectMapper;
import com.kun.music.domain.Collect;
import com.kun.music.service.CollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author fangkun
 * @create 2023-01-04-11:46
 */
@Service
public class CollectServiceImpl implements CollectService {

    @Autowired
    private CollectMapper collectMapper;


    @Override
    public List<Collect> userCollection(int userId) {
        return collectMapper.userCollection(userId);
    }

    @Override
    public boolean deleteUserCollect(int userId, int songId) {
        return collectMapper.deleteUserCollect(userId,songId) > 0 ? true : false;
    }

    @Override
    public boolean existSongId(int user_id, int song_id) {
        return collectMapper.existSongId(user_id,song_id) > 0 ? true : false;
    }

    @Override
    public boolean addCollection(Collect collect) {
        return collectMapper.addCollection(collect) > 0 ? true : false;
    }
}
